package yh;

/**
 * @Author:云尚
 * @Description:
 * 递归必须指定程序出口,否者报错：StackOverflowError
 * 堆栈溢出错误
 */
public class RecursiveDemo2 {
    //递归调用没有指定方法出口，无限调用
    void print(int i) {
        System.out.println(i);
        i++;
        print(i);
    }
    public static void main(String[] args) {
        RecursiveDemo2 recursiveDemo2 = new RecursiveDemo2();
        recursiveDemo2.print(1);
    }
}
